
package samples;
// {{{ imports
import jp.ize.ux.UXRoot;
import jp.ize.ux.components.UXBasicComponent;
import jp.ize.ux.components.UXCell;
import jp.ize.ux.components.UXTable;
import jp.ize.ux.components.UXLabel;
import jp.ize.ux.components.UXTextField;
import jp.ize.ux.acts.MoveAct;
import jp.ize.ux.acts.TableLayoutAct;
import jp.ize.ux.events.UXMouseEvent;
import jp.ize.ux.events.UXKeyboardEvent;
import jp.ize.ux.tween.easings.Linear;
import jp.ize.ux.tween.easings.Expo;
import jp.ize.ux.geom.UXPoint;
import jp.ize.ux.geom.UXSize;
import jp.ize.iwp.RuntimeEngine;
import jp.ize.iwp.utils.DebugUtil;
import flash.ui.Keyboard;
// }}}
// {{{ class Move
class Move
{
	// {{{ public static function main() : Void
	/**
	*
	*/
	public static function main() : Void
	{
		RuntimeEngine.init();
		DebugUtil.init();
		DebugUtil.setLocation( 300, 500 );
		// {{{ index
		var comp001 = new UXLabel("==1==",16,0xFFFFFF);
		var comp002 = new UXLabel("==2==",16,0xFFFFFF);
		var comp003 = new UXLabel("==3==",16,0xFFFFFF);
		var comp004 = new UXLabel("==4==",16,0xFFFFFF);
		var comp005 = new UXLabel("==5==",16,0xFFFFFF);
		// }}}
		// {{{ field 0
		var comp0 = new UXBasicComponent(); // dummy cell
		var comp1 = new UXBasicComponent(); // dummy cell
		// }}}
		// {{{ field 1
		var comp2 = new UXLabel("名前",16,0xFFFFFF);
		var comp3 = new UXTextField("",16,0xFFFFFF,new UXSize(100,20));
		// }}}
		// {{{ field 2
		var comp4 = new UXLabel("年齢",16,0xFFFFFF);
		var comp5 = new UXTextField("",16,0xFFFFFF,new UXSize(100,20));
		// }}}
		// {{{ field 3
		var comp6 = new UXLabel("職業",16,0xFFFFFF);
		var comp7 = new UXTextField("",16,0xFFFFFF,new UXSize(100,20));
		// }}}
		// {{{ field 4
		var comp8 = new UXBasicComponent(); // dummy cell
		var comp9 = new UXBasicComponent(); // dummy cell
		// }}}

		var table = new UXTable( new UXSize(300,150), 5, 3 );

		// {{{ acts and parameters
		var act  = new MoveAct();
		var act2 = new TableLayoutAct();
		var param = {
			time: 1.0,
			transition: Linear.easeOut,
			p0: null,
			p1: new UXPoint(400,0),
			p2: new UXPoint(400,400)
		};
		var param2 = {
			time: 1.0,
			transition: Linear.easeOut,
			center: new UXPoint(400,250),
			radius: 150.0,
			starta: 270.0,
			enda: 90.0
		};
		var param3 = {
			time: 0.5,
			transition: Linear.easeOut,
			point: new UXPoint(100,100)
		};
		var param4 = {
			time: 3.0,
			transition: Expo.easeIn
		};
		var param5 = {
			time: 2.0,
			transition: Linear.easeIn,
			center:{row:0,col:0}
		};
		var param6 = {
			time: 0.3,
			transition: Linear.easeIn,
			dir: ROW,
			delta: -1
		};
		// }}}
		
		table.ctrl.getInteraction("Layout").addReactEvent( UXMouseEvent.DOWN );
		table.ctrl.getInteraction("Layout").setActSequentialMode(true);
		//table.ctrl.getInteraction("Layout").addReactEvent( UXKeyboardEvent.KEY_DOWN );
		table.ctrl.getInteraction("Layout").addAct( act.curvingMove(param) );
		table.ctrl.getInteraction("Layout").addAct( act.rotate(param2) );
		table.ctrl.getInteraction("Layout").addAct( act.move(param3) );
		table.ctrl.getInteraction("Layout").addAct( act2.layout(param4) );

		table.addItem( new UXCell(comp001) );
		table.addItem( new UXCell(comp0) ); // [nearly equal] table.setItem(0,0,new UXCell(comp1))
		table.addItem( new UXCell(comp1) ); // [nearly equal] table.setItem(0,1,new UXCell(comp1))
		table.addItem( new UXCell(comp002) );
		table.addItem( new UXCell(comp2) ); // [nearly equal] table.setItem(1,0,new UXCell(comp1))
		table.addItem( new UXCell(comp3) ); // [nearly equal] table.setItem(1,1,new UXCell(comp1))
		table.addItem( new UXCell(comp003) );
		table.addItem( new UXCell(comp4) ); // [nearly equal] table.setItem(2,0,new UXCell(comp1))
		table.addItem( new UXCell(comp5) ); // [nearly equal] table.setItem(2,1,new UXCell(comp1))
		table.addItem( new UXCell(comp004) );
		table.addItem( new UXCell(comp6) ); // [nearly equal] table.setItem(3,0,new UXCell(comp1))
		table.addItem( new UXCell(comp7) ); // [nearly equal] table.setItem(3,1,new UXCell(comp1))
		table.addItem( new UXCell(comp005) );
		table.addItem( new UXCell(comp8) ); // [nearly equal] table.setItem(4,0,new UXCell(comp1))
		table.addItem( new UXCell(comp9) ); // [nearly equal] table.setItem(4,1,new UXCell(comp1))

		UXRoot.addUXChild( table );
	}

	// }}}
}
// }}}
